//
//  ConversationViewController.m
//  PaiQuan
//
//  Created by Mac on 16/7/7.
//  Copyright © 2016年 huigu. All rights reserved.
//

#import "ConversationViewController.h"
#import "detailsViewController.h"
#import "PersonalViewController.h"
#import "JHTitleView.h"
@interface ConversationViewController ()<JHTitleViewDelegate>

@end

@implementation ConversationViewController
-(instancetype)init
{
    if (self = [super init])
    {
        [self setupTitleView];
    }
    return self;
}

-(instancetype)initWithCoder:(NSCoder *)aDecoder
{
    if (self = [super initWithCoder:aDecoder])
    {
        [self setupTitleView];
    }
    return self;
}
-(UIStatusBarStyle)preferredStatusBarStyle{
    return UIStatusBarStyleLightContent ;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationController.navigationBarHidden = YES;
    [self.view addSubview:self.titleView];
    self.titleView.title = self.title;
    [self.titleView.btnBack setImage:PQIMG(@"back") forState:UIControlStateNormal];
     
    [self.titleView.btnBack setTitle:@"返回" forState:UIControlStateNormal];
    [self setUPUI];
    
    [self.titleView.rightBtn setTitle:@"详情" forState:UIControlStateNormal];
    [self.titleView.rightBtn setTitleColor:PQ_COLOR_YELLOW forState:UIControlStateNormal];
    [self.titleView.rightBtn addTarget:self action:@selector(rightBtnDidClick) forControlEvents:UIControlEventTouchUpInside];

   
}
- (void)setupTitleView
{
    self.titleView = [[JHTitleView alloc] initWithFrame:CGRectMake(0,0, ScreenW, NaviBarHeight)];
    self.titleView.delegate = self;
    
}
-(void)jhTitleView:(JHTitleView *)titleView clickBackButton:(UIButton *)backbtn
{
    if (self.navigationController.topViewController == self)
    {
        [self.navigationController popViewControllerAnimated:YES];
    }
}
-(void)viewDidAppear:(BOOL)animated{
    [super viewDidAppear:animated];
    [self.view bringSubviewToFront:self.titleView];
}




-(void)viewWillAppear:(BOOL)animated{
    
    [super viewWillAppear:animated];
       
      self.navigationController.navigationBar.translucent = NO;
       
}
-(void)doBack{
    
    [self.navigationController popViewControllerAnimated:YES];
}
-(void)setUPUI{	
    //观看按钮
    UIButton *Lookbtn = [[UIButton alloc] init];
    Lookbtn.layer.cornerRadius = 6;
    Lookbtn.layer.masksToBounds = YES;
    Lookbtn.backgroundColor  = [UIColor redColor];
    [self.view addSubview:Lookbtn];
    [Lookbtn makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view.top).offset(RATIO(152));
        make.right.equalTo(self.view.right).offset(-RATIO(20));
        make.width.height.equalTo(RATIO(50));
    }];
    [Lookbtn addTarget:self action:@selector(lookBtnDidClick) forControlEvents:UIControlEventTouchUpInside];
    //加入游戏按钮
    UIButton *addBtn = [[UIButton alloc] init];
    addBtn.layer.cornerRadius = 6;
    addBtn.layer.masksToBounds = YES;

    addBtn.backgroundColor  = [UIColor redColor];
    [self.view addSubview:addBtn];
    [addBtn makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view.top).offset(RATIO(152));
        make.right.equalTo(Lookbtn.left).offset(-RATIO(20));
        make.width.height.equalTo(RATIO(50));
    }];
    [addBtn addTarget:self action:@selector(addBtnDidClick) forControlEvents:UIControlEventTouchUpInside];
    //开始游戏按钮
    UIButton *startGameBtn = [[UIButton alloc] init];
    startGameBtn.layer.cornerRadius = 6;
    startGameBtn.layer.masksToBounds = YES;

    startGameBtn.backgroundColor  = [UIColor redColor];
    [self.view addSubview:startGameBtn];
    [startGameBtn makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(Lookbtn.bottom).offset(RATIO(14));
        make.right.equalTo(self.view.right).offset(-RATIO(30));
        make.width.equalTo(RATIO(100));
        make.height.equalTo(RATIO(50));
        
    }];
    [startGameBtn addTarget:self action:@selector(startGameBtnDidClick) forControlEvents:UIControlEventTouchUpInside];
   

    
    
    
}
#pragma mark --按钮的点击事件啊
-(void)lookBtnDidClick{
    
    
}
-(void)addBtnDidClick{
    
    
}
-(void)startGameBtnDidClick{
    
    
}

-(void)rightBtnDidClick{
    detailsViewController *detailVC =[[detailsViewController alloc] init];
   
    
    [self.navigationController pushViewController:detailVC animated:YES];
    
}
- (void)didTapCellPortrait:(NSString *)userId{
    
    
    PersonalViewController *personVC = [[PersonalViewController alloc] init];
    
    [self.navigationController pushViewController:personVC animated:YES];
    
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
